home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / Display Manager SDK / Sample Code / Display Changed CWPro4 / Headers / App.h next >
Encoding:
C/C++ Source or Header  |  1996-10-20  |  4.4 KB  |  190 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************
  2. #
  3. #        App.h
  4. #
  5. #        This file contains the constants and structures definitions.
  6. #
  7. #        Author(s):     Michael Marinkovich
  8. #                    marink@apple.com
  9. #
  10. #        Modification History: 
  11. #
  12. #            10/12/95    MWM     Initial coding                     
  13. #
  14. #        Copyright © 1992-96 Apple Computer, Inc., All Rights Reserved
  15. #
  16. #
  17. #        You may incorporate this sample code into your applications without
  18. #        restriction, though the sample code has been provided "AS IS" and the
  19. #        responsibility for its operation is 100% yours.  However, what you are
  20. #        not permitted to do is to redistribute the source as "DSC Sample Code"
  21. #        after having made changes. If you're going to re-distribute the source,
  22. #        we require that you make it clear in the source that the code was
  23. #        descended from Apple Sample Code, but that you've made changes.
  24. #
  25. *************************************************************************************/
  26.  
  27. #include <QDOffscreen.h>
  28.  
  29. //---------------------------------------------------------------------
  30. //
  31. //    Macros
  32. //
  33. //---------------------------------------------------------------------
  34.  
  35. #define MIN(x,y)            ( ((x)<(y)) ? (x) : (y) )
  36. #define MAX(x,y)            ( ((x)>(y)) ? (x) : (y) )
  37. #define TopLeft( r )        ( *(Point *) &(r).top )
  38. #define BotRight( r )        ( *(Point *) &(r).bottom )
  39.  
  40.  
  41. //---------------------------------------------------------------------
  42. //
  43. //    General
  44. //
  45. //---------------------------------------------------------------------
  46.  
  47. #define kMinHeap            300 * 1024
  48. #define kMinSpace            300 * 1024
  49.  
  50.  
  51. //---------------------------------------------------------------------
  52. //
  53. //    Menus
  54. //
  55. //---------------------------------------------------------------------
  56.  
  57. #define rMBarID                128
  58.  
  59. enum {
  60.      mApple                    = 128,
  61.     iAbout                    = 1,
  62.  
  63.     mFile                    = 129,
  64.     iNew                    = 1,
  65.     iOpen                    = 2,
  66.     iClose                    = 3,
  67.     iQuit                    = 5
  68. };
  69.  
  70.  
  71. //---------------------------------------------------------------------
  72. //
  73. //    Window stuff
  74. //
  75. //---------------------------------------------------------------------
  76.  
  77. // doc types
  78. enum {
  79.     kDocKind                = 94,
  80.     kDialogKind                = 95,
  81.     kFloatKind                = 96,
  82.     kAboutKind                = 97
  83. };    
  84.  
  85.  
  86. // scroll values
  87. #define kScrollWidth        15
  88. #define kScrollDelta        16
  89.  
  90.  
  91. //---------------------------------------------------------------------
  92. //
  93. //    General resource ID's
  94. //
  95. //---------------------------------------------------------------------
  96.  
  97. #define rAboutPictID        3000 // about picture
  98. #define rErrorDlg            128     // main error dialog
  99.  
  100.  
  101. //---------------------------------------------------------------------
  102. //
  103. //    Alert Error ID's
  104. //
  105. //---------------------------------------------------------------------
  106.  
  107. #define kNeedsDisplayManager        128    // ID of no Display Manager
  108.  
  109.  
  110. //---------------------------------------------------------------------
  111. //
  112. //    Custom Event Proc stuff
  113. //
  114. //---------------------------------------------------------------------
  115.  
  116. struct ZoomData {
  117.     GDHandle        screenWithLargestPartOfWindow;
  118.     unsigned long    largestArea;
  119.     Rect            windowBounds;
  120. };
  121. typedef struct ZoomData ZoomData, *ZoomDataPtr;
  122.  
  123.  
  124. enum {
  125.     kIdleProc            = 1,
  126.     kMenuProc,
  127.     kInContentProc,
  128.     kInGoAwayProc,
  129.     kInZoomProc,
  130.     kInGrowProc,
  131.     kMUpProc,
  132.     kKeyProc,
  133.     kActivateProc,
  134.     kUpdateProc
  135. };
  136.     
  137.  
  138. //---------------------------------------------------------------------
  139. //
  140. //    Typedefs
  141. //
  142. //---------------------------------------------------------------------
  143.  
  144. // event handling proc
  145. typedef void (*CustomProc)(WindowRef window, void *refCon);
  146.  
  147.  
  148. // we just use the basic events for the callback procs
  149.  
  150. struct DocRec
  151. {    
  152.     CustomProc                    idleProc;            // custom idle proc
  153.     CustomProc                    mMenuProc;            // custom menu proc
  154.     CustomProc                    inContentProc;        // custom content click Proc
  155.     CustomProc                    inGoAwayProc;        // custom inGoAway proc
  156.     CustomProc                    inZoomProc;            // custom inZoom proc
  157.     CustomProc                    inGrowProc;            // custom inGrow proc
  158.     CustomProc                    mUpProc;            // custom mouseUp proc
  159.     CustomProc                    keyProc;            // custom autoKey-keyDown proc
  160.     CustomProc                    activateProc;        // custom activate window proc
  161.     CustomProc                    updateProc;            // custom window update proc
  162.     ControlRef                    hScroll;            // horz scroll bar
  163.     ControlRef                    vScroll;            // vert scroll bar
  164.     GWorldPtr                    world;                // offscreen for pict imaging
  165.     PicHandle                    pict;                // windows picture
  166.     THPrint                        printer;            // apps print record - inited at window int
  167.     Boolean                        dirty;                // document needs saving
  168. };
  169.  
  170. typedef struct DocRec DocRec;
  171. typedef DocRec *DocPtr, **DocHnd;
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.